<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml" xmlns:v-on="http://www.w3.org/1999/xhtml"
      xmlns:v-bind="http://www.w3.org/1999/xhtml">
<head>
    <meta name="viewport" content="width=device-width, initial-scale=1.0"/>
    <meta http-equiv="pragma" content="no-cache" />
    <meta http-equiv="content-type" content="no-cache, must-revalidate" />
    <meta http-equiv="expires" content="Wed, 26 Feb 1997 08:21:57 GMT"/>
    <title>赛事报名</title>
    <link rel="stylesheet" href="../css/bootstrap.min.css">
    <link rel="stylesheet" href="../css/common.css">
    <link rel="stylesheet" href="../css/nav.css">
    <link rel="stylesheet" href="../css/font-awesome.css">
    <link rel="stylesheet" href="../css/element/index.css">
	<link rel="stylesheet" href="../css/hsg.css">
</head>
<body>
<div id="wrapper" v-cloak>
    <div >
        <div style="padding: 0 20px">
            <div>
                <div style="color: #666; font-weight: bold; border-bottom: 1px solid #ccc; padding: 10px 0; margin-bottom: 20px; font-size: 30px;">赛事报名</div>
            </div>
            <div style="margin-top: 10px">
                <div style="border: 1px solid #ff6b31;">
                    <div style="padding: 5px; border-bottom: 1px solid #ff6b31; color: white; background-color: #ff6b31;">赛事报名表</div>
                    <div style="border: 1px solid #ccc; padding: 10px">
                        <div class="table-responsive">
                            <div class="nx-table-header" style="position: relative">
                             
								<button class="btn btn-sm btn-primary" v-on:click="downExcel">导出excel</button>
                                <input type="text" placeholder="请输入搜索内容" v-model="name" @keyup.enter="loadTable(1)">
                                <i class="glyphicon glyphicon-search" style="margin-left: -20px"></i>
                            </div>
                            <table class="table table-striped table-bordered table-hover">
                                <thead>
                                <tr>
                                    <th>ID</th>
                                    <th>报名编号</th><th>赛事名称</th><th>赛事地点</th><th>报名费</th><th>用户名</th><th>姓名</th><th>性别</th><th>身份证</th><th>手机号</th><th>状态</th><th>是否支付</th>
                                    <th>操作</th>
                                </tr>
                                </thead>
                                <tbody v-for="obj in objs">
                                <tr>
                                    <td>{{obj.id}}</td>
									<td>{{obj.baomingbianhao}}</td><td>{{obj.saishimingcheng}}</td><td>{{obj.saishididian}}</td><td>{{obj.baomingfei}}</td><td>{{obj.yonghuming}}</td><td>{{obj.xingming}}</td><td>{{obj.xingbie}}</td><td>{{obj.shenfenzheng}}</td><td>{{obj.shoujihao}}</td><td>{{obj.zhuangtai}}</td> <td>{{obj.iszf}}</td>
                                    <td>
                                         
										<button class="btn btn-primary btn-xs" @click="liangbu(obj)">报名审核</button>
										<button class="btn btn-primary btn-xs" @click="detail(obj.id)">详细</button>
                                        <button class="btn btn-danger btn-xs" @click="del(obj.id)">删除</button>                                    </td>
                                </tr>
                                </tbody>
                            </table>
							<!--danhxexiaxnshi-->
                            <nav aria-label="Page navigation example">
                                <ul class="pagination">
                                    <li class="page-item" v-bind:class="{ disabled: preActive }">
                                        <a class="page-link" href="javascript:void(0)"
                                           v-on:click="loadTable(pageInfo.pageNum - 1)">上一页</a>
                                    </li>
                                    <li class="page-item">
                                        <a class="page-link" href="javascript:void(0)" v-if="pageInfo.pageNum > 1" v-on:click="loadTable(pageInfo.pageNum - 1)">{{pageInfo.pageNum - 1}}</a>
                                    </li>
                                    <li class="page-item disabled">
                                        <a class="page-link" aria-disabled="true" href="javascript:void(0)">{{pageInfo.pageNum}}</a>
                                    </li>
                                    <li class="page-item">
                                        <a class="page-link" href="javascript:void(0)" v-if="pageInfo.hasNextPage" v-on:click="loadTable(pageInfo.pageNum + 1)">{{pageInfo.pageNum + 1}}</a>
                                    </li>
                                    <li class="page-item" v-bind:class="{ disabled: nextActive }">
                                        <a class="page-link" href="javascript:void(0)" v-on:click="loadTable(pageInfo.hasNextPage? (pageInfo.pageNum + 1) : pageInfo.pageNum)">下一页</a>
                                    </li>
                                </ul>
                            </nav>
                        </div>
                    </div>
                </div>
            </div>
        </div>
    </div>
    <div class="modal" tabindex="-1" role="dialog" id="mod">
        <div class="modal-dialog" role="document">
            <div class="modal-content">
                <div class="modal-header">
                    <span class="modal-title">请填写信息</span>
                    <button type="button" class="close" data-dismiss="modal" aria-label="Close">
                        <span aria-hidden="true">&times;</span>
                    </button>
                </div>
                <div class="modal-body">
                    <form class="form-horizontal">
                        <input type="hidden" id="id" name="id" v-model="entity.id">
                        <div  class="form-group"><label class="col-sm-3 control-label">报名编号</label><div class="col-sm-7"><input type="text" class="form-control" v-model="entity.baomingbianhao" style="width: 160px" placeholder="请输入报名编号" id="baomingbianhao"></div></div>
		<div  class="form-group"><label class="col-sm-3 control-label">赛事名称</label><div class="col-sm-7"><input type="text" class="form-control" v-model="entity.saishimingcheng" style="width: 160px" placeholder="请输入赛事名称" id="saishimingcheng" disabled ></div></div>
		<div  class="form-group"><label class="col-sm-3 control-label">赛事地点</label><div class="col-sm-7"><input type="text" class="form-control" v-model="entity.saishididian" style="width: 160px" placeholder="请输入赛事地点" id="saishididian" disabled ></div></div>
		<div  class="form-group"><label class="col-sm-3 control-label">报名费</label><div class="col-sm-7"><input type="text" class="form-control" v-model="entity.baomingfei" style="width: 160px" placeholder="请输入报名费" id="baomingfei" disabled ></div></div>
		<div  class="form-group"><label class="col-sm-3 control-label">用户名</label><div class="col-sm-7"><input type="text" class="form-control" v-model="entity.yonghuming" style="width: 160px" placeholder="请输入用户名" id="yonghuming" disabled></div></div>
		<div  class="form-group"><label class="col-sm-3 control-label">姓名</label><div class="col-sm-7"><input type="text" class="form-control" v-model="entity.xingming" style="width: 160px" placeholder="请输入姓名" id="xingming"></div></div>
		<div  class="form-group"><label class="col-sm-3 control-label">性别</label><div class="col-sm-7"><input type="text" class="form-control" v-model="entity.xingbie" style="width: 160px" placeholder="请输入性别" id="xingbie"></div></div>
		<div  class="form-group"><label class="col-sm-3 control-label">身份证</label><div class="col-sm-7"><input type="text" class="form-control" v-model="entity.shenfenzheng" style="width: 160px" placeholder="请输入身份证" id="shenfenzheng"></div></div>
		<div  class="form-group"><label class="col-sm-3 control-label">手机号</label><div class="col-sm-7"><select class="form-control" v-model="entity.shoujihao"></select></div></div>
		<div style='display:none' class="form-group"><label class="col-sm-3 control-label">状态</label><div class="col-sm-7"><select class="form-control" v-model="entity.zhuangtai"><option value="已报名">已报名</option><option value="审核通过">审核通过</option></select></div></div>
		<div style='display:none' class="form-group"><label class="col-sm-3 control-label">审核回复</label><div class="col-sm-7"><textarea type="text" class="form-control" v-model="entity.shenhehuifu" style="height: 100px" placeholder="请输入审核回复" id="shenhehuifu"></textarea></div></div>
		
                    </form>
                </div>
                <div class="modal-footer">
                    <button type="button" class="btn btn-secondary" data-dismiss="modal">关闭</button>
					
                    <button type="button" class="btn btn-primary" @click="update()">保存</button>
                </div>
            </div>
        </div>
    </div>
	<div class="modal" tabindex="-1" role="dialog" id="modliangbu">
        <div class="modal-dialog" role="document">
            <div class="modal-content">
                <div class="modal-header">
                    <span class="modal-title">请填写信息</span>
                    <button type="button" class="close" data-dismiss="modal" aria-label="Close">
                        <span aria-hidden="true">&times;</span>
                    </button>
                </div>
                <div class="modal-body">
                    <form class="form-horizontal">
                        <input type="hidden" id="id" name="id" v-model="entity.id">
                        <div style='display:none' class="form-group"><label class="col-sm-3 control-label">报名编号</label><div class="col-sm-7"><input type="text" class="form-control" v-model="entity.baomingbianhao" style="width: 160px" placeholder="请输入报名编号" id="baomingbianhao"></div></div>
		<div style='display:none' class="form-group"><label class="col-sm-3 control-label">赛事名称</label><div class="col-sm-7"><input type="text" class="form-control" v-model="entity.saishimingcheng" style="width: 160px" placeholder="请输入赛事名称" id="saishimingcheng" disabled ></div></div>
		<div style='display:none' class="form-group"><label class="col-sm-3 control-label">赛事地点</label><div class="col-sm-7"><input type="text" class="form-control" v-model="entity.saishididian" style="width: 160px" placeholder="请输入赛事地点" id="saishididian" disabled ></div></div>
		<div style='display:none' class="form-group"><label class="col-sm-3 control-label">报名费</label><div class="col-sm-7"><input type="text" class="form-control" v-model="entity.baomingfei" style="width: 160px" placeholder="请输入报名费" id="baomingfei" disabled ></div></div>
		<div style='display:none' class="form-group"><label class="col-sm-3 control-label">用户名</label><div class="col-sm-7"><input type="text" class="form-control" v-model="entity.yonghuming" style="width: 160px" placeholder="请输入用户名" id="yonghuming" disabled></div></div>
		<div style='display:none' class="form-group"><label class="col-sm-3 control-label">姓名</label><div class="col-sm-7"><input type="text" class="form-control" v-model="entity.xingming" style="width: 160px" placeholder="请输入姓名" id="xingming"></div></div>
		<div style='display:none' class="form-group"><label class="col-sm-3 control-label">性别</label><div class="col-sm-7"><input type="text" class="form-control" v-model="entity.xingbie" style="width: 160px" placeholder="请输入性别" id="xingbie"></div></div>
		<div style='display:none' class="form-group"><label class="col-sm-3 control-label">身份证</label><div class="col-sm-7"><input type="text" class="form-control" v-model="entity.shenfenzheng" style="width: 160px" placeholder="请输入身份证" id="shenfenzheng"></div></div>
		<div style='display:none' class="form-group"><label class="col-sm-3 control-label">手机号</label><div class="col-sm-7"><select class="form-control" v-model="entity.shoujihao"></select></div></div>
		<div  class="form-group"><label class="col-sm-3 control-label">状态</label><div class="col-sm-7"><select class="form-control" v-model="entity.zhuangtai"><option value="已报名">已报名</option><option value="审核通过">审核通过</option></select></div></div>
		<div  class="form-group"><label class="col-sm-3 control-label">审核回复</label><div class="col-sm-7"><textarea type="text" class="form-control" v-model="entity.shenhehuifu" style="height: 100px" placeholder="请输入审核回复" id="shenhehuifu"></textarea></div></div>
		
                    </form>
                </div>
                <div class="modal-footer">
                    <button type="button" class="btn btn-secondary" data-dismiss="modal">关闭</button>
					
                    <button type="button" class="btn btn-primary" @click="update()">保存</button>
                </div>
            </div>
        </div>
    </div>
</div>
<script src="../js/jquery-1.10.2.js"></script>
<script src="../js/bootstrap.min.js"></script>
<script src="../js/nav.js"></script>
<script src="../js/my.js"></script>
<script src="../js/vue2.6.11/vue.min.js"></script>
<script src="../js/vue2.6.11/axios.js"></script>
<script src="../js/element/index.js"></script>

<script>
    function checkValid(entity) {
        
        return true;
    }
    new Vue({
        el: '#wrapper',
        data: {

            authority: [],
            permission: [],
            storeUser: JSON.parse(localStorage.getItem("user")),
            name: '',
            user: {},
			
			//youtupianimrl
            objs: [],
            pageInfo: {},
            preActive: true,
            nextActive: true,
			
			//youxia2sui
			//youxxiabiaoxduan
            entity: {
               
            }
        },
        created:
            function () {
                this.loadTable(1);
                this.user = JSON.parse(localStorage.getItem('user'));
                axios.get("/permission/3").then(res => {
                    if (res.data.code === '0') {
                        this.permission = res.data.data;
                    } else {
                        msg('error', res.data.msg);
                    }
                });
                axios.get("/authority").then(res => {
                    if (res.data.code === '0') {
                        this.authority = res.data.data;
                    } else {
                        msg('error', res.data.msg);
                    }
                });
				//youcreatexia2sui
				//youffxiaxbiaoxduan
				
				//youtixing
				
            },
        methods: {
            loadTable(pageNum) {
                let name = this.name === '' ? "all" : this.name;
                axios.get("/saishibaomingInfo/page/" + name + "?pageNum=" + pageNum).then(res => {
                    if (res.data.code === '0') {
                        this.objs = res.data.data.list;
                        res.data.data.list.forEach(item=>{
                            //tupianloadtb
							//dhjsuanxx
                        })
                        this.pageInfo = res.data.data;
                        this.preActive = !(this.pageInfo.hasPreviousPage);
                        this.nextActive = !(this.pageInfo.hasNextPage);
                    } else {
                        msg('error', res.data.msg);
                    }
                });
            },
			
			detail(id) {window.location = '/end/page/saishibaoming_detail.html?saishibaomingid='+id;},
            init(o) {

                this.entity = JSON.parse(JSON.stringify(o));
				//tupianxinxiit4
                $('#mod').modal('show');
            },
			liangbu(o) {
                 if (this.user.level === "管理员")
                 {}
                 else
                 {
                    msg('warning', '你没有权限操作');
                    return;
                  }
                this.entity = JSON.parse(JSON.stringify(o));
				//tupianxinxiit4
                $('#modliangbu').modal('show');
            },
            add() {

				if (this.user.level === "注册用户"){msg('warning', '你没有权限操作');return;}

				this.entity = {};this.entity.baomingbianhao = uuid();
                
				
				
				if (this.user.level === "注册用户"){this.entity.yonghuming = this.user.yonghuming;}
				if (this.user.level === "用户注册"){this.entity.yonghuming = this.user.yonghuming;}
                if (this.user.level === "用户注册"){this.entity.xingming = this.user.xingming;}
                if (this.user.level === "用户注册"){this.entity.xingbie = this.user.xingbie;}
                if (this.user.level === "用户注册"){this.entity.shenfenzheng = this.user.shenfenzheng;}
                if (this.user.level === "用户注册"){this.entity.shoujihao = this.user.shoujihao;}

                $('#mod').modal('show');
            },
            update() {
                if (checkValid(this.entity)) {
                    debugger
                    if (!this.entity.id) {
                        axios.post(
                            "/saishibaomingInfo", this.entity
                        ).then(res => {
                            if (res.data.code === '0') {
                                msg('success', '添加成功');
                                $('#mod').modal('hide');
                                this.loadTable(1);
                            } else {
                                msg('error', res.data.msg);
                            }
                        })
                    } else {
                        axios.put(
                            "/saishibaomingInfo", this.entity
                        ).then(res => {
                            if (res.data.code === '0') {
                                msg('success', '更新成功');
                                $('#mod').modal('hide');
                                this.loadTable(1);
                            } else {
                                msg('error', res.data.msg);
                            }
                        })
                    }
                }
            },
			//m_tupiansccsbaul
            del(id) {
                let _this = this;
                this.$confirm('确认删除？', '系统提示', {
                    confirmButtonText: '确定',
                    cancelButtonText: '取消',
                    cancelButtonClass: 'btn-custom-cancel',
                    type: 'warning'
                }).then(function(){
                    axios.delete("/saishibaomingInfo/" + id).then(res => {
                        if (res.data.code === '0') {
                            msg('success', '删除成功');
                            _this.loadTable(1);
                        } else {
                            msg('error', res.data.msg);
                        }
                    });
                }).catch(function() {
                    console.log("取消成功！");
                });
            },
            downModel() {
                location.href = '/saishibaomingInfo/getExcelModel';
            },
			downExcel() {
                location.href = '/saishibaomingInfo/getExcel';
            },
            clickUpload: function (e) {
                if (this.user.level === "管理员")
                {}
                else
                {
                    msg('warning', '你没有权限操作');
                    return;
                }
            },
            upload: function () {
                let files = this.$refs.file.files;
                for (let i = 0; i < files.length; i++) {
                    let formData = new FormData();
                    formData.append('file', files[i]);
                    axios.post('/saishibaomingInfo/upload', formData, {
                        'Content-Type': 'multipart/form-data'
                    }).then(res => {
                        if (res.data.code === '0') {
                            msg('success', '批量导入成功');
                            this.loadTable(1);
                        } else {
                            msg('error', res.data.msg);
                        }
                    })
                }
            },
			//youscwenjian
            changeStatus(id){
                let _this = this;
                axios.get("/saishibaomingInfo/changeStatus/" + id).then(res => {
                    if (res.data.code === '0') {
                        msg('success', '状态修改成功');
                        _this.loadTable(this.pageInfo.pageNum);
                    } else {
                        msg('error', res.data.msg);
                    }
                });
            },
			iszf(id,ze,yuan) {
                if (this.user.level === "注册用户")
                {}
                else
                {
                    msg('warning', '你没有权限操作');
                    return;
                }
                if(yuan==='是')
                {
                    msg('warning', '该订单已支付，请勿重复!');
                    return;
                }
                let _this = this;
                axios.get("/saishibaomingInfo/changeIszf/" + id).then(res => {
                    if (res.data.code === '0') {
                        location.href = 'zhifu/index.html?ze='+ze;
                        _this.loadTable(this.pageInfo.pageNum);
                    } else {
                        msg('error', res.data.msg);
                    }
                });

            },
			//x2suilafuxzhi
            logout() {
                logout();
            }
        }
    })
</script>
</body>
</html>